# -*- coding: utf-8 -*-
# 功能：添加/删除连接服务器需要的IP、端口、密码
# 自动输入密码登录远程服务器

import os
import sys
import settings
import auto_ssh
path = os.path.dirname(os.path.abspath(sys.argv[0]))


def main():
	while True:
		print('='*15 + 'SSH[Menu]' + '='*15)
		print('<1> Connect a host\n<2> Add host\n<3> Remove host\n<4> About\n[Help]: <q>:quit <clear>: clear screen')
		print('='*40)
		choice = input('Please select depend on tips:')
		if choice == 1 or choice == '1':
			auto_ssh.choose_host()
		elif choice == 2 or choice == '2':
			settings.add_hosts()
		elif choice == 3 or choice == '3':
			settings.remove_host()
		elif choice == 4 or choice == '4':
			settings.about()
		elif choice == 'q' or choice == 'Q' or choice == 'quit' or choice == 'exit':
			print('Bye...')
			sys.exit()
		elif choice == 'clear' or 'cls':
			os.system('cls')
		else:
			print('No use input...')


if __name__ == '__main__':
	try:
		f = open('{}/data/info.d'.format(path))
	except:
		f = open('{}/data/info.d'.format(path), 'w')
	f.close()
	main()